/**
 * Created by admin on 2018/2/7.
 */
    //调用作业模块样式文件task.css
(function loadCss( ){
    var url=basePathOnline+'/home/css/task.css';
    var link = document.createElement( "link" );
    link.type = "text/css";
    link.rel = "stylesheet";
    link.href =  url;
    $(document.getElementsByTagName( "head" )[0]).append(link);
})();
//作业
template.helper('options', function (options) {
    if (options != null && options != "") {
        return JSON.parse(options);
    }
});
template.helper('optionsImg', function (options, i) {
    var pic,flag=false;
    if (options != null && options != "") {
        pic = JSON.parse(options);
        pic.forEach(function(cur,index,array){
            flag=false;
            if(cur!=""){
                flag=true;
            }
        });
        if(flag){
            return '</br><img class="smallImg" src="' + pic[i] + '"/>'
        }
    }
});

template.helper("attachmentName",function(url){
    var attName="",id="";
    var weizhi=url.lastIndexOf("/");
    var attachmentName=url.substring(weizhi+1,url.length);
    RequestService("/attachmentCenter/getAttachmentByFileName","GET",{fileName:attachmentName},function(name){
        if(name.error==0){
            attName=name.orgFileName;
            id=name.id;
        }
    },false);
    return {filename:attName,id:id};
});

//下载文件
template.helper("downloadattach",function(obj){
    return basePathOnline+"/phaseWork/questionAttachmentDownload?id="+obj.id+"&fileName="+obj.filename;
});

template.helper("duoOptionList", function (answer, canKaoList) {
    answer = JSON.parse(answer);
    var optionsList = "";
    for (var i = 0; i < answer.length; i++) {
        optionsList += canKaoList[answer[i]] + "、";
    }
    optionsList = optionsList.substring(0, optionsList.length - 1);
    return optionsList;
});
//把填空题 题干里的【】替换成INPUT框
template.helper("tiankongTi",function(question_head){
    var tkReg=/(【[/w/W]*】)/g;
    question_head=question_head.replace(tkReg,function(){
        return '<input type="text" class="tiankongTiInput"/>';
        /* return '<span type="text" contenteditable="true" class="tiankongTiInput"/></span>';*/
    });
    return question_head;
});
template.helper("tiankkongReview",function(answer){
    answer=answer.replace(/\^/g,",");
    answer=JSON.parse(answer);
    return answer.join(",");
});

template.helper('filterBr',function(con){
    var reg = /\<\/?(br){1}\s*\/?\s*\>/gim;
    con=con.replace(reg,"");
    return con;
});
//多选题答案回显 不显示选择结果是否正确
template.helper('duoxuanAnswer',function(answer,i){
    if (answer != null && answer != "") {
        answer = JSON.parse(answer);
        return answer.some(function(val) { return val==i});
    }
});

//把填空题 题干里的【】替换成INPUT框 并且回显答案
template.helper("tiankongTiAnswer",function(question_head,answer){
    var tkReg=/(【[/w/W]*】)/g,i=0;
    return question_head.replace(tkReg,function(){
        if(answer!="" && answer!=null){
            var tkAnswer=JSON.parse(answer);
            return '<input type="text" class="tiankongTiInput" value="'+tkAnswer[i++]+'"/>';
        }else{
            return '<input type="text" class="tiankongTiInput"/>';
        }
    });
});

var optionList = ["A、", "B、", "C、", "D、", "E、", "F、", "G、", "H、", "I、", "G、", "K、", "L、", "M、", "N、"],
    canKaoAns = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "G", "K", "L", "M", "N"],
    type=['单选题','多选题','判断题','填空题','简答题','代码题','实操题'],
    examInfo = '<div class="examBasicInfoTop clearfix">' +
        '<div class="examName" title="{{items.paper_name}}">{{items.phaseWorkName}}</div>' +
        '<div class="examCount"><span class="currentQuestionNum">0</span>/{{items.totalQuestionNum}}</div>' +
        '</div>' +
        '<div class="examResult">' +
        '<div class="examResult_rate clearfix">' +
        '<div class="pingji">评级：{{#star(items.rating)}}</div>' +
        '{{if items.status==1}}' +
        '<div class="isTongguo correntAns"><i class="iconfont icon-xiaolian"></i>恭喜你，顺利通过本次阶段作业！</div>' +
        '{{else if items.status==-1}}' +
        '{{if stuPhaseId==undefined}}' +
        '<div class="anotherTask">导师又为你布置了一套阶段作业~ <a class="check" href="/paper/assignment.html?phaseWorkId={{items.nextPhaseHomeworkId}}&courseId={{items.courseId}}">点击查看</a></div>' +
        '{{/if}}' +
        '<div class="isTongguo errorAns">当前阶段作业未能通过！</div>' +
        '{{/if}}' +
        '</div>' +
        '<div class="examResult_comment_title">' +
        '<div class="comment clearfix"><span class="examResult_comment">评语：</span>'+
        '<div class="downAttach dot5" data-text="{{items.comment}}">{{#items.comment}}</div>'+
        '</div>' +
        '</div>' +
        '</div>',
    paperNav='<ul class="timuTypeBox clearfix">' +
        '{{each paperNav as item i}}' +
        '{{if i==0}}'+
        '<li data-timutype="{{i}}" class="d{{i}} select">{{type[paperNav[i]]}}</li>' +
        '{{else}}' +
        '<li data-timutype="{{i}}" class="d{{i}}" >{{type[paperNav[i]]}}</li>' +
        '{{/if}}' +
        '{{/each}}'+
        '</ul>',
    answerCard='{{each paperNav as item i}}' +
        '<li class="radioAnswer">' +
        '<span>{{type[paperNav[i]]}}</span>' +
        '<ol class="clearfix">' +
        '{{each answerCard as $value}}' +
        '{{if $value.questionType==paperNav[i]}}' +
        '{{if ($value.answer!="" && $value.answer!=null && $value.answer!="[]") || ($value.attachmentFile!="" && $value.attachmentFile!=null)}}' +
        '<li class="select" data-answerId="{{$index}}">{{++$index}}</li>' +
        '{{else}}' +
        ' <li data-answerId="{{$index}}">{{++$index}}</li>' +
        '{{/if}}' +
        '{{/if}}' +
        '{{/each}}' +
        '</ol>' +
        '</li>'+
        '{{/each}}',
    answerCardResult='{{each paperNav as item i}}' +
        '<li class="radioAnswer">' +
        '<span>{{type[paperNav[i]]}}</span>' +
        '<ol class="clearfix">' +
        '{{each answerCard as $value}}' +
        '{{if $value.questionType==paperNav[i]}}' +
        '{{if ($value.answer!="" && $value.answer!=null && $value.answer!="[]") || ($value.attachmentFile!="" && $value.attachmentFile!=null)}}' +
        '<li class="select" data-answerId="{{$index}}">{{++$index}}</li>' +
        '{{else}}' +
        ' <li class="noAnswer" data-answerId="{{$index}}">{{++$index}}</li>' +
        '{{/if}}' +
        '{{/if}}' +
        '{{/each}}' +
        '</ol>' +
        '</li>'+
        '{{/each}}',
//basicTestId  学前测试提交参数[{"questionHistoryId":1,"userAnswerr":"xxx","attachmentFile":"www.baidu.com" ,"basicTestId":1,"questionType":"6"}]
//checkPointId  小节测试提交参数[{"checkPointId":1,"questionHistoryId":3,"answer":"xxx"}]
//调用paperTemp模板  传参样例：
// isShowType:false,//是否显示题目类型
//isShowNum:true,//是否显示题号
//optionList: optionList,//选项  A,B,C...
//quesList: paper
    paperTemp= '{{each quesList as $value $index}}' +
        ' <li class="question{{$value.questionType}}" ' +
        'data-indexId="{{$index}}" ' +
        'data-type="{{$value.questionType}}" ' +
        'data-basicTestId="{{$value.basicTestId}}"' +
        'data-questionHistoryId="{{$value.questionHistoryId}}"' +
        'data-checkPointId="{{$value.checkPointId}}">' +
        '{{if $value.questionType=="3"}}' +
        '{{if isShowNum}}{{$index+1}}、{{/if}}{{if isShowType}}【{{type[$value.questionType]}}】{{/if}}{{#tiankongTiAnswer(filterBr($value.questionHead),$value.answer)}}' +
        '{{if $value.attachments}}' +
        '{{each $value.attachments as attach}}' +
        '{{if attach.type=="1" }}' +
        '<a href="{{downloadattach(attachmentName(attach.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}' +
        '   {{/each}}' +
        '{{/if}}' +
        '{{if $value.filePath}}' +
        '<a href="{{downloadattach(attachmentName($value.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}'+
        '{{else}}'+
        '{{if isShowNum}}{{$index+1}}、{{/if}}{{if isShowType}}【{{type[$value.questionType]}}】{{/if}}{{#filterBr($value.questionHead)}}' +
        '{{if $value.attachments}}' +
        '{{each $value.attachments as attach}}' +
        '{{if attach.type=="1" }}' +
        '<a href="{{downloadattach(attachmentName(attach.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}' +
        '{{/each}}' +
        '{{/if}}' +
        '{{if $value.filePath}}' +
        '<a href="{{downloadattach(attachmentName($value.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}'+
        '{{/if}}'+
        '{{if $value.questionType=="0"}}' +
        '<ol class="ExamAnswer">' +
        '{{each options($value.options) as $val i}}' +
        '{{if $value.answer==[i]}}' +
        '<li class="danxuanTi select" data-selectAnswer="{{i}}">' +
        '{{else}}' +
        '<li class="danxuanTi" data-selectAnswer="{{i}}">' +
        '{{/if}}' +
        '<div><em class="radioBtn"></em></div>' +
        '{{optionList[i]}}<span>{{$val}}</span>' +
        '{{if $value.optionsPicture!="" && $value.optionsPicture!=null}}' +
        '{{#optionsImg($value.optionsPicture,i)}}' +
        '{{/if}}' +
        '{{/each}}' +
        '</li>' +
        '</ol>' +
        '{{/if}}' +

        '{{if $value.questionType==1}}' +
        '<ol class="ExamAnswer dxt" data-da="{{$value.answer}}">' +
        '{{each options($value.options) as $val i}}' +
        '{{if duoxuanAnswer($value.answer,i)}}' +
        '<li class="duoxuanTi select" data-selectAnswer="{{i}}">' +
        '{{else}}'+
        '<li class="duoxuanTi" data-selectAnswer="{{i}}">' +
        '{{/if}}'+
        '<div><em class="checkboxBtn"><i class="iconfont icon-xuanzhong"></i></em></div>' +
        '{{optionList[i]}}<span>{{$val}}</span>' +
        '{{if $value.optionsPicture!="" && $value.optionsPicture!=null}}' +
        '{{#optionsImg($value.optionsPicture,i)}}' +
        '{{/if}}' +
        '</li>' +
        '{{/each}}' +
        '</ol>' +
        '{{/if}}' +

        '{{if $value.questionType==2}}' +
        '<ol class="ExamAnswer">' +
        '{{if $value.answer!="" && $value.answer!=null}}' +
        '{{if $value.answer=="对"}}' +
        '<li class="panduanTi select" data-selectAnswer="0">' +
        '{{else}}'+
        '<li class="panduanTi" data-selectAnswer="0">' +
        '{{/if}}'+
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '{{if $value.answer=="错"}}' +
        '<li class="panduanTi select" data-selectAnswer="1">' +
        '{{else}}'+
        '<li class="panduanTi" data-selectAnswer="1">' +
        '{{/if}}'+
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{else}}' +
        '<li class="panduanTi" data-selectAnswer="0">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '<li class="panduanTi" data-selectAnswer="1">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{/if}}' +
        '</ol>' +
        '{{/if}}' +

        '{{if $value.questionType=="4"}}' +
        '<div class="examRichText">'+
        '<textarea id="editor{{$index}}" data-indexId="{{$index}}" data-type="{{$value.questionType}}" data-basicTestId="{{$value.basicTestId}}" data-questionHistoryId="{{$value.questionHistoryId}}" class="ckeditor" maxlength="7000" name="editor{{$index}}" style="width:100%;height:243px"></textarea>'+
        '</div>'+
        '{{/if}}' +

        '{{if $value.questionType=="5" || $value.questionType=="6"}}' +
        '{{if $value.questionType=="5"}}'+
        '<div class="examRichText">'+
        '<textarea id="editor{{$index}}"  data-indexId="{{$index}}"  data-type="{{$value.questionType}}" data-basicTestId="{{$value.basicTestId}}" data-questionHistoryId="{{$value.questionHistoryId}}" class="ckeditor" maxlength="7000" name="editor{{$index}}" style="width:100%;height:243px"></textarea>'+
        '</div>'+
        '{{/if}}'+
        '{{if $value.questionType=="6"}}'+
        '<div class="upload">'+
        '<p>【上传答案】</p>' +
        '{{else}}'+
        '<div class="upload" style="text-align:right;">'+
        '{{/if}}'+
        '<div class="upBtn">'+
        '<form id="form{{$index}}"  method="post" enctype="multipart/form-data">'+
        '<input type="hidden" name="projectName" value="online"/>'+
        '<input type="hidden" name="fileType" class="fileType" value="2"/>'+
        '{{if $value.questionType=="6"}}'+
        '<span class="chooseFile">上传附件</span>'+
        '{{else}}'+
        '<span class="chooseFile">上传附件</span>'+
        '{{if $value.attachments}}{{each $value.attachments as attach}}' +
        '{{if attach.type=="1" }}' +
        '<a class="attachmentName" href="{{downloadattach(attachmentName(attach.filePath))}}" target="_blank">' +
        '{{#attachmentName(attach.filePath).filename}}' +
        '</a>' +
        '{{/if}}' +
        '{{/each}}' +
        '{{/if}}' +
        '{{/if}}'+
        '<input type="file" name="upload" class="file"/>'+
        ' </form>'+
        '</div>'+
        '{{if $value.attachmentFile!="" && $value.attachmentFile!=null}}'+
        '<a class="attachmentName" href="{{downloadattach(attachmentName($value.attachmentFile))}}"  target="_blank">' +
        '{{#attachmentName($value.attachmentFile).filename}}' +
        '</a>'+
        '{{/if}}'+
            /* '<span><em>*</em>请上传格式为jpg、gif、png、txt、word、excel、zip、rar且小于100M的文件</span>'+*/
        '</div>'+
        '{{/if}}' +
        '</li>' +
        '{{/each}}',

//带参考答案的模版
//调用paperResultTemp模板  传参样例：
//isShowNum:true,//是否显示题号
//    isShowType:false,//是否显示题目类型
//    optionList: optionList,//选项  A,B,C...
//    canKaoAns:canKaoAns,
//    quesList: paper,
//    type:type
    paperResultTemp= '{{each quesList as $value $index}}' +
        ' <li class="question{{$value.questionType}}" data-indexId="{{$index}}" data-type="{{$value.questionType}}" data-questionHistoryId="{{$value.questionHistoryId}}">' +
        '{{if $value.questionType=="3"}}' +
        '{{if isShowNum}}{{$index+1}}、{{/if}}{{if isShowType}}【{{type[$value.questionType]}}】{{/if}}{{#tiankongTiAnswer(filterBr($value.questionHead),$value.answer)}}' +
        '{{if $value.attachments}}' +
        '{{each $value.attachments as attach}}' +
        '{{if attach.type=="1" }}' +
        '<a href="{{downloadattach(attachmentName(attach.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}' +
        '{{/each}}' +
        '{{/if}}' +
        '{{if $value.filePath}}' +
        '<a href="{{downloadattach(attachmentName($value.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}'+
        '{{if status!=0}}' +
        '<div class="answersCont"><p><span class="cankaoAnswer">正确答案：</span>{{#tiankkongReview($value.standardAnswer)}}</p>' +
        '<div><span class="answerShouMing">答案解析：</span><span>{{#$value.solution}}</span></div>' +
        '</div>' +
        '{{/if}}' +
        '{{else}}'+
        '{{if isShowNum}}{{$index+1}}、{{/if}}{{if isShowType}}【{{type[$value.questionType]}}】{{/if}}{{#filterBr($value.questionHead)}}' +
        '{{if $value.attachments}}{{each $value.attachments as attach}}' +
        '{{if attach.type=="1" }}' +
        '<a href="{{downloadattach(attachmentName(attach.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}' +
        '{{/each}}{{/if}}' +
        '{{if $value.filePath}}' +
        '<a href="{{downloadattach(attachmentName($value.filePath))}}" target="_blank">下载附件</a>' +
        '{{/if}}'+
        '{{/if}}'+
        '{{if $value.questionType=="0"}}' +
        '<ol class="ExamAnswer">' +
        '{{each options($value.options) as $val i}}' +
        '{{if $value.answer==[i] && $value.standardAnswer==$value.answer}}' +
        '<li class="danxuanTi select correntAns" data-selectAnswer="{{i}}">' +
        '<div><em class="radioBtn correntAns"></em></div>' +
        '{{else}}' +
        '{{if $value.answer==[i] && $value.standardAnswer!=$value.answer}}' +
        '<li class="danxuanTi select errorAns" data-selectAnswer="{{i}}">' +
        '<div><em class="radioBtn errorAns"></em></div>' +
        '{{else}}' +
        '<li class="danxuanTi" data-selectAnswer="{{i}}">' +
        '<div><em class="radioBtn"></em></div>' +
        '{{/if}}' +
        '{{/if}}' +
        '{{optionList[i]}}<span>{{$val}}</span>' +
        '{{if $value.optionsPicture!="" && $value.optionsPicture!=null}}' +
        '{{#optionsImg($value.optionsPicture,i)}}' +
        '{{/if}}' +
        '{{/each}}' +
        '</li>' +
        '</ol>' +
        '{{if status!=0}}' +
        '<div class="answersCont"><p><span class="cankaoAnswer">正确答案：</span>' +
        '{{if $value.result}}' +
        '<span>{{#canKaoAns[$value.standardAnswer]}}<span class="correntAns"><i class="iconfont icon-zhengque answerIcon"></i>你选对了</span></span>' +
        '{{else}}'+
        '<span>{{#canKaoAns[$value.standardAnswer]}}<span class="errorAns"><i class="iconfont icon-cuowu answerIcon"></i>你选错了</span></span>' +
        '{{/if}}'+
        '</p>' +
        '<div><span class="answerShouMing">答案解析：</span><span>{{#$value.solution}}</span></div>' +
        '</div>' +
        '{{/if}}' +
        '{{/if}}' +
        '{{if $value.questionType==1}}' +
        '<ol class="ExamAnswer dxt" data-da="{{$value.answer}}" data-answer="{{$value.standardAnswer}}">' +
        '{{each options($value.options) as $val i}}' +
        '{{if duoxuanAnswer($value.answer,i)}}' +
        '<li class="duoxuanTi select"  id="li{{i}}" data-selectAnswer="{{i}}">' +
        '{{else}}'+
        '<li class="duoxuanTi"   id="li{{i}}" data-selectAnswer="{{i}}">' +
        '{{/if}}'+
        '<div><em class="checkboxBtn"><i class="iconfont icon-xuanzhong"></i></em></div>' +
        '{{optionList[i]}}<span>{{$val}}</span>' +
        '{{if $value.optionsPicture!="" && $value.optionsPicture!=null}}' +
        '{{#optionsImg($value.optionsPicture,i)}}' +
        '{{/if}}' +
        '</li>' +
        '{{/each}}' +
        '</ol>' +
        '{{if status!=0}}' +
        '<div class="answersCont"><p><span class="cankaoAnswer">正确答案：</span>' +
        '{{#duoOptionList($value.standardAnswer,canKaoAns)}}</p>' +
        '{{if $value.result}}' +
        '<span>{{#canKaoAns[$value.standardAnswer]}}<span class="correntAns"><i class="iconfont icon-zhengque answerIcon"></i>你选对了</span></span>' +
        '{{else}}'+
        '<span>{{#canKaoAns[$value.standardAnswer]}}<span class="errorAns"><i class="iconfont icon-cuowu answerIcon"></i>你选错了</span></span>' +
        '{{/if}}'+
        '<div><span class="answerShouMing">答案解析：</span><span>{{#$value.solution}}</span></div>' +
        '</div>' +
        '{{/if}}' +
        '{{/if}}' +

        '{{if $value.questionType==2}}' +
        '<ol class="ExamAnswer">' +
        '{{if $value.answer=="对"}}' +
        '{{if $value.answer==$value.standardAnswer}}' +
        '<li class="panduanTi select correntAns" data-selectAnswer="0">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '<li class="panduanTi" data-selectAnswer="1">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{else}}' +
        '<li class="panduanTi select errorAns" data-selectAnswer="0">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '<li class="panduanTi" data-selectAnswer="1">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{/if}}{{/if}}' +

        '{{if $value.answer=="错"}}' +
        '{{if $value.answer==$value.standardAnswer}}' +
        '<li class="panduanTi" data-selectAnswer="0">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '<li class="panduanTi select correntAns" data-selectAnswer="1">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{else}}' +
        '<li class="panduanTi" data-selectAnswer="0">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '<li class="panduanTi select errorAns" data-selectAnswer="1">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{/if}}{{/if}}' +

        '{{if $value.answer=="" || $value.answer==null}}' +
        '<li class="panduanTi" data-selectAnswer="0">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>√</span>' +
        '</li>' +
        '<li class="panduanTi" data-selectAnswer="1">' +
        '<div><em class="panduanBtn"></em></div>' +
        '<span>×</span>' +
        '</li>' +
        '{{/if}}' +
        '</ol>' +
        '{{if status!=0}}' +
        '<div class="answersCont"><p><span class="cankaoAnswer">正确答案：</span>{{$value.standardAnswer}}' +
        '{{if $value.result}}' +
        '<span>{{#canKaoAns[$value.standardAnswer]}}<span class="correntAns"><i class="iconfont icon-zhengque answerIcon"></i>你选对了</span></span>' +
        '{{else}}'+
        '<span>{{#canKaoAns[$value.standardAnswer]}}<span class="errorAns"><i class="iconfont icon-cuowu answerIcon"></i>你选错了</span></span>' +
        '{{/if}}'+
        '</p>' +
        '<div><span class="answerShouMing">答案解析：</span><span>{{#$value.solution}}</span></div>' +
        '</div>' +
        '{{/if}}' +
        '{{/if}}' +

        '{{if $value.questionType=="4"}}' +
        '<div class="examRichText">'+
        '<textarea id="editor{{$index}}" data-indexId="{{$index}}" data-questionHistoryId="{{$value.questionHistoryId}}" class="ckeditor" maxlength="7000" name="editor{{$index}}" style="width:100%;height:243px"></textarea>'+
        '</div>'+
        '{{if status!=0}}' +
        '<div class="answersCont"><div><span class="cankaoAnswer">正确答案：</span>{{#$value.standardAnswer}}</div>' +
        '<div><span class="answerShouMing">答案解析：</span><span>{{#$value.solution}}</span></div>' +
        '{{/if}}' +
        '{{/if}}' +

        '{{if $value.questionType=="5" || $value.questionType=="6"}}' +
        '{{if $value.questionType=="5"}}'+
        '<div class="examRichText">'+
        '<textarea id="editor{{$index}}"  data-indexId="{{$index}}"  data-questionHistoryId="{{$value.questionHistoryId}}" class="ckeditor" maxlength="7000" name="editor{{$index}}" style="width:100%;height:243px"></textarea>'+
        '</div>'+
        '{{/if}}'+
        '{{if $value.questionType=="6"}}'+
        '<div class="upload">'+
        '<p>【上传答案】</p>' +
        '{{else}}'+
        '<div class="upload" style="text-align:right;">'+
        '{{/if}}'+
        '<div class="upBtn">'+
        '<form id="form{{$index}}"  method="post" enctype="multipart/form-data">'+
        '{{if $value.questionType=="6"}}'+
        '<span class="chooseFile">上传附件</span>'+
        '{{else}}'+
        '<span class="chooseFile">上传附件</span>'+
        '{{if $value.attachments!="" && $value.attachments!=null}}'+
        '<a class="attachmentName" href="{{downloadattach(attachmentName($value.attachments[1].filePath))}}"  target="_blank">' +
        '{{#attachmentName($value.attachments[1].filePath).filename}}' +
        '</a>'+
        '{{/if}}'+
        '{{/if}}'+
        '<input type="file" name="upload" class="file"/>'+
        ' </form>'+
        '</div>'+
        '{{if $value.attachmentFile !="" && $value.attachmentFile !=null}}'+
        '<a class="attachmentName" href="{{downloadattach(attachmentName($value.attachmentFile))}}"  target="_blank">' +
        '{{#attachmentName($value.attachmentFile).filename}}' +
        '</a>'+
        '{{/if}}'+
            /* '<span><em>*</em>请上传格式为jpg、gif、png、txt、word、excel、zip、rar且小于100M的文件</span>'+*/
        '</div>'+
        '{{if status!=0}}' +
        '<div class="answersCont"><p><span class="cankaoAnswer">正确答案：</span>' +
        '{{if $value.attachments}}' +
        '{{each $value.attachments as attach}}' +
        '{{if attach.type=="2" }}' +
        '<a href="{{downloadattach(attachmentName(attach.filePath))}}" target="_blank">' +
        '{{#attachmentName($value.attachments[1].filePath).filename}}' +
        '</a>' +
        '{{/if}}' +
        '{{/each}}' +
        '{{/if}}' +
        '</p>' +
        '<div><span class="answerShouMing">答案解析：</span><span>{{#$value.solution}}</span></div>' +
        '{{/if}}' +
        '{{/if}}' +
        '</li>' +
        '{{/each}}',
    popupTemp1='<div class="noCompleteHint">' +
        '<div class="noCompleteInnerBox">' +
        '<img src="/videoPlayer/images/close.png" class="guanbi"/>' +
        '<div class="noCompleteContent">' +
        '<img src="/videoPlayer/images/qsIcon.png"/>' +
        '<p>还有<span class="count"></span>题目没有答完</br>是否确定交卷？</p>' +
        '<div class="continueAnswer">继续答题</div>' +
        '<div class="tijiao">坚持交卷</div>' +
        '</div>' +
        '</div>' +
        '</div>';
